﻿<cfmodule template="../../tag/layout.cfm">
	<div id="loginDialog" title="系统登录" style="display: none; width: 320px; height: 180px; overflow: hidden;">
		<form method="post" class="form">
			<table class="table" style="width: 100%; height: 100%;">
				<tr>
					<th width="50">登录名</th>
					<td><input name="loginname" class="easyui-validatebox" data-options="required:true" value="chinavane" style="width: 210px;" /></td>
				</tr>
				<tr>
					<th>密码</th>
					<td><input name="pwd" type="password" class="easyui-validatebox" data-options="required:true" value="chinavane" style="width: 210px;" /></td>
				</tr>
			</table>
		</form>
	</div>
</cfmodule>
</script>
<script type="text/javascript">
	$(function() {

		var loginFun = function() {
			$.post('?action=user.login', fw.serializeObject($('form')), function(result) {
				if (result) {
					if(window.parent.length>0){
						window.parent.location ='/index.cfm';
					}else{
						location.replace('/index.cfm');
					}
				}
			}, 'json');
		};
	
		$('#loginDialog').show().dialog({
			modal : false,
			closable : false,
			iconCls : 'ext-icon-lock_open',
			buttons : [
			{
				id : 'loginBtn',
				text : '系统登录',
				handler : function() {
					loginFun();
				}
			} ],
			onOpen : function() {
				$('form :input:first').focus();
				$('form :input').keyup(function(event) {
					if (event.keyCode == 13) {
						loginFun();
					}
				});
			}
		});

	});
</script>
